﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; 
using System.Windows.Forms;

namespace WarsKeyChanger
{
    public class StockConfig:WarsKeyConfig
    { 
        public StockConfig(string configFilePath):base(configFilePath, "物品栏设置")
        { 
        } 

        public Keys NumPad1HotKey
        {
            get
            {
                var hotKeyValue = ConfigFileInfo.GetSectionKeyValue(this.SectionName, Keys.NumPad1.ToString());
                if (string.IsNullOrEmpty(hotKeyValue))
                {
                    ConfigFileInfo.SetSectionKeyValue(this.SectionName, Keys.NumPad1.ToString(), (((int)Keys.NumPad1)).ToString());
                    return Keys.NumPad1;
                }
                else 
                {
                    return (Keys)int.Parse(hotKeyValue);
                }
            }
        }
        public Keys NumPad2HotKey
        {
            get
            {
                var hotKeyValue = ConfigFileInfo.GetSectionKeyValue(this.SectionName, Keys.NumPad2.ToString());
                if (string.IsNullOrEmpty(hotKeyValue))
                {
                    ConfigFileInfo.SetSectionKeyValue(this.SectionName, Keys.NumPad2.ToString(), ((int)Keys.NumPad2).ToString());
                    return Keys.NumPad2;
                }
                else
                {
                    return (Keys)int.Parse(hotKeyValue);
                }
            }
        }

        public Keys NumPad4HotKey
        {
            get
            {
                var hotKeyValue = ConfigFileInfo.GetSectionKeyValue(this.SectionName, Keys.NumPad4.ToString());
                if (string.IsNullOrEmpty(hotKeyValue))
                {
                    ConfigFileInfo.SetSectionKeyValue(this.SectionName, Keys.NumPad4.ToString(), ((int)Keys.NumPad4).ToString());
                    return Keys.NumPad4;
                }
                else
                {
                    return (Keys)int.Parse(hotKeyValue);
                }
            }
        }
        public Keys NumPad5HotKey
        {
            get
            {
                var hotKeyValue = ConfigFileInfo.GetSectionKeyValue(this.SectionName, Keys.NumPad5.ToString());
                if (string.IsNullOrEmpty(hotKeyValue))
                {
                    ConfigFileInfo.SetSectionKeyValue(this.SectionName, Keys.NumPad5.ToString(), ((int)Keys.NumPad5).ToString());
                    return Keys.NumPad5;
                }
                else
                {
                    return (Keys)int.Parse(hotKeyValue);
                }
            }
        }

        public Keys NumPad7HotKey
        {
            get
            {
                var hotKeyValue = ConfigFileInfo.GetSectionKeyValue(this.SectionName, Keys.NumPad7.ToString());
                if (string.IsNullOrEmpty(hotKeyValue))
                {
                    ConfigFileInfo.SetSectionKeyValue(this.SectionName, Keys.NumPad7.ToString(), ((int)Keys.NumPad7).ToString());
                    return Keys.NumPad7;
                }
                else
                {
                    return (Keys)int.Parse(hotKeyValue);
                }
            }
        }
        public Keys NumPad8HotKey
        {
            get
            {
                var hotKeyValue = ConfigFileInfo.GetSectionKeyValue(this.SectionName, Keys.NumPad8.ToString());
                if (string.IsNullOrEmpty(hotKeyValue))
                {
                    ConfigFileInfo.SetSectionKeyValue(this.SectionName, Keys.NumPad8.ToString(), ((int)Keys.NumPad8).ToString());
                    return Keys.NumPad8;
                }
                else
                {
                    return (Keys)int.Parse(hotKeyValue);
                }
            }
        }

    }
}
